#include <Arduino.h>
#include <Wire.h>
#include "SSD1306.h"
#include "OLED_task.h"
#include "typedefine.h"

SSD1306 display(0x3c, 2, 15);
extern esp32_sta_t sta;

void OLED_task(void *pvParameters) {
    display.init();
    display.setI2cAutoInit(true);
    display.setFont(ArialMT_Plain_10);
    
    while (1) {
        display.clear(); 
        // display.display();
        
        // 绘制状态信息
        display.drawString(0, 0, sta.wifi_connected ? "WiFi OK!" : "WiFi INIT..");
        display.drawString(0, 14, sta.server_connected ? "SER OK!" : "SER INIT..");
        display.drawString(0, 28, sta.server_command);
        
        display.display(); 
        vTaskDelay(500);  
    }
}
